﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BankCheck.aspx.cs" Inherits="Thksoft.Module.BillManagement.BankCheck" %>

<!DOCTYPE html>
<html class="L_UI">
<head id="Head1" runat="server">
    <title>银行本票</title>
    <link href="/UserCotrols/My97DatePicker/skin/WdatePicker.css" rel="stylesheet" type="text/css" />
    <script src="/UserCotrols/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-1.7.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        var option = {};
        option.Area = ["950px", "440px"];

        option.CancelCallback = function (index, layero) {
            //刷新页面
            //location.href = location.href;
            $("#btnSelect").click();
        };

        function FORM_INSERT() {

            option.Url = "../Modal/BankCheckEdit.aspx";
            option.Title = "新增银行本票";
            top.MessageBox.Load(option);
        }
        function FORM_EDIT(id) {
            option.Url = "../Modal/BankCheckEdit.aspx?ID=" + id;
            option.Title = "编辑银行本票";
            top.MessageBox.Load(option);
        }

        function btnEdit_Click() {
            var data = GET_CHECKS();
            console.log(data.length);
            if (data.length == 1) {
                if (confirm("是否编辑?")) {
                    FORM_EDIT(data[0].Key);
                }
            }
            else {
                top.MessageBox.Alert("请先选择其中一项");
                return;
            }
        }

        //获取选中的项 （类型对象数组,Item Key 选中项的主键）
        function GET_CHECKS() {
            var data = [];
            $("#grvShow1 td :checkbox").each(function () {
                if ($(this).is(":checked")) {
                    var key = $(this).attr("data-id");
                    data.push({ Key: key });
                }
            })
            return data;
        }

        function show(id) {
            var type = 1;
            var option = {};
            option.Area = ['900px', '400px'];
            option.Title = '银行本票明细';
            if (type == 1) {
                option.Scrollbar = false;
                option.shadeClose = true;
                option.maxmin = true;
                option.Url = '/Module/BillManagement/BankCheckDetailed.aspx?ID=' + id;
            }

            top.MessageBox.Load(option);
        }
    </script>
</head>
<body>
    <form id="form2" runat="server">
        <div class="Window" style="min-width: 1100px;">
            <div class="Header" style="height: 106px;">
                <table border="0" cellpadding="0" cellspacing="0" width="100%" class="table">
                    <tr>
                        <td style="width: 7%; text-align: right; padding-right: 5px;">出票公司：
                        </td>
                        <td style="width: 20%; text-align: left; padding-left: 10px;">
                            <uc2:CtrlCompany runat="server" ID="FORM_COMPANY_ID" Width="170px" />
                        </td>
                        <td style="width: 7%; text-align: right; padding-right: 5px;">银行名称：
                        </td>
                        <td style="width: 20%; text-align: left; padding-left: 10px;">
                            <asp:DropDownList ID="FORM_BANK_ID" runat="server" Width="170px">
                            </asp:DropDownList>
                        </td>
                        <td style="width: 7%; text-align: right; padding-right: 5px;">出票日期：
                        </td>
                        <td style="text-align: left; padding-left: 10px;">
                            <input id="txtDate" runat="server" class="Wdate" style="width: 85px;" type="text"
                                onclick="WdatePicker()" />
                            至
                        <input id="txtEnd" runat="server" class="Wdate" style="width: 85px;" type="text"
                            onclick="WdatePicker()" />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 7%; text-align: right; padding-right: 5px;">申请人：
                        </td>
                        <td style="width: 12%; text-align: left; padding-left: 10px;">
                            <asp:TextBox ID="txtNAMEUSER" runat="server" Width="168px" CssClass="lblName" Text=""></asp:TextBox>
                        </td>
                        <td style="width: 7%; text-align: right; padding-right: 5px;">收款人：
                        </td>
                        <td style="width: 12%; text-align: left; padding-left: 10px;" colspan="3">
                            <asp:TextBox ID="txtNAMEPAYEE" runat="server" Width="168px" CssClass="lblName" Text=""></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="6">
                            <asp:Button ID="btnSelect" runat="server" Text="查询" CssClass="bt_css_s" OnClick="btnSelect_Click" />&nbsp;
                        <asp:Button ID="btnInsert" runat="server" Text="新增" CssClass="bt_css_s" OnClick="btnInsert_Click" />&nbsp;
                        <button type="button" class="bt_css_s" onclick="btnEdit_Click()">
                            编辑</button>&nbsp;
                        <%--<asp:Button ID="btnEdit" runat="server" Text="修改" CssClass="bt_css_s" OnClick="btnEdit_Click"
                                        OnClientClick="return ValidateEdit();" />&nbsp;--%>
                            <asp:Button ID="btnDaoChu" runat="server" Text="导出" CssClass="bt_css_s" OnClick="btnDaoChu_Click" />
                        </td>
                    </tr>
                </table>
            </div>
            <div class="Content" style="top: 108px;">
                <div class="Pg-Content">
                    <asp:ScriptManager ID="ScriptManagers" runat="server" EnablePageMethods="True" EnableScriptGlobalization="True"
                        EnableScriptLocalization="True">
                    </asp:ScriptManager>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <asp:GridView ID="grvShow1" runat="server" AutoGenerateColumns="False" CssClass="cont_list zebra"
                                Width="100%" EmptyDataText="没有查找到您要的数据" AllowSorting="True" OnSorting="grvShow1_Sorting">
                                <Columns>
                                    <asp:TemplateField ItemStyle-Width="5%">
                                        <HeaderTemplate>
                                            <asp:CheckBox ID="chkSelectAll" runat="server" Onclick="GetAllCheckBox(this)" />
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <%--<asp:CheckBox ID="chkSelectId" runat="server" ToolTip='<%#Eval("N_BANKCHECK_ID")%>' />--%>
                                            <input <%#Eval("N_BANKCHECK_ID")==DBNull.Value?"class='hide'":"" %> type="checkbox"
                                                id="chkSelectId" data-id="<%#Eval("N_BANKCHECK_ID")%>" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="CMY_NAME" HeaderText="出票人公司名称" SortExpression="CMY_NAME"
                                        ItemStyle-Width="7%" />
                                    <asp:BoundField DataField="C_NAME" HeaderText="银行名称" SortExpression="C_NAME" ItemStyle-Width="13%" />
                                    <asp:BoundField DataField="C_BANKCHECK_NAMEPAYEE" HeaderText="收款人" SortExpression="C_BANKCHECK_NAMEPAYEE"
                                        ItemStyle-Width="7%" />
                                    <asp:BoundField DataField="USER_NAME" HeaderText="申请人" SortExpression="USER_NAME"
                                        ItemStyle-Width="7%" />
                                    <asp:BoundField DataField="D_BANKCHECK_DATE" HeaderText="出票日期" SortExpression="D_BANKCHECK_DATE"
                                        ItemStyle-Width="10%" />
                                    <asp:BoundField DataField="N_BANKCHECK_MONEY" HeaderText="出票金额" SortExpression="N_BANKCHECK_MONEY"
                                        ItemStyle-Width="5%" />
                                    <asp:BoundField DataField="N_BANKCHECK_TYPE" HeaderText="支付类型" SortExpression="N_BANKCHECK_TYPE"
                                        ItemStyle-Width="5%" />
                                    <asp:BoundField DataField="C_BANKCHECK_REMARK" HeaderText="备注" SortExpression="C_BANKCHECK_REMARK" ItemStyle-CssClass="left" ItemStyle-Width="10%" />
                                    <asp:TemplateField HeaderText="详情" ItemStyle-Width="5%">
                                        <ItemTemplate>
                                            <input <%#Eval("N_BANKCHECK_ID")==DBNull.Value?"class='hide'":"" %> type="image"
                                                src="../../Images/XiangXi.png" onclick='show(<%#Eval("N_BANKCHECK_ID") %>);'
                                                title="查看详细" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
                <div class="Pg">
                    <uc1:Pagination ID="PageIng" runat="server" OnDataBinding="PageIng_DataBinding" Visible="false" />
                </div>
            </div>
        </div>
    </form>
</body>